package entity

import "gitee.com/linxing_3/sr-core/domain/model"

type SysUserThirdBind struct {
	UserId     string `json:"userId" form:"userId" gorm:"size:64;primaryKey;comment:用户ID"`   // 用户ID
	Platform   string `json:"platform" form:"platform" gorm:"size:64;primaryKey;comment:平台"` // 平台
	OpenId     string `json:"openId" form:"openId" gorm:"size:128;comment:平台openId"`         // 平台openId
	Account    string `json:"account" form:"account" gorm:"size:64;comment:平台账号"`            // 平台账号
	NickName   string `json:"nickName" form:"nickName" gorm:"size:64;comment:平台昵称"`          // 平台昵称
	Avatar     string `json:"avatar" form:"avatar" gorm:"size:256;comment:平台头像"`             // 平台头像
	OrganizeId string `json:"organizeId" form:"organizeId" gorm:"size:64;comment:组织ID"`      // 组织ID
	Token      string `json:"token" form:"token" gorm:"size:256;comment:平台token"`            // 平台token

	model.GAllInject
}

func (SysUserThirdBind) TableName() string {
	return "sys_user_third_bind"
}

func (s SysUserThirdBind) GetOpenId() (string, bool) {
	return s.OpenId, true
}

func NewSysUserThirdBind() *SysUserThirdBind {
	return &SysUserThirdBind{}
}

func (s *SysUserThirdBind) SetId(id, platform string) *SysUserThirdBind {
	s.UserId = id
	s.Platform = platform
	return s
}
